import bannerSlider from './template/houseImgSlide.vue';
import houseAllocation from './template/houseAllocation.vue';
import aMap from '@/components/aMap.vue';

export default {
  name: "houseDetail",
  data: () => ({
    houseId:'',
    houseKeywords:[],
    isShow:false,
    houseInfo:'',     //房源详情
    housePicList:[],  //房源图片集
    recommendedHouseList:[],    //推荐房源
    houseRentConfigList:[],     //房源配置
    lng:'',
    lat:'',
  }),
  methods: {
    showmore() {
      this.isShow = true;
      console.log(this.isShow);
    },
    // 获取房源详情
    getHouseDetail() {
      var that = this;
      // var token = that.global.global.token;
      var houseParam = {
        houseId:that.houseId
      }
      network.get(configUrl.LANDLORDHOUSEDETAIL_URL,houseParam,function(res){
        console.log(res);
        var house = res.data.house;
        that.houseInfo = house;
        that.housePicList = res.data.housePicList;
        that.recommendedHouseList = res.data.recommendedHouseList;
        that.houseRentConfigList = res.data.houseRentConfigList;
        that.houseKeywords = res.data.houseTagList;
        that.center = [house.lng,house.lat];
      },function(err){
        console.log(err);
      });
    },
    // 房源配备
    getHouseConfig() {
      var that = this;
      network.get(configUrl.HOUSECONFIG_URL,'',function(res){
        console.log(res);
      },function(err){
        console.log(err);
      });
    },
    // 编辑房源
    editHouseCK() {
      this.$router.push({path:'/editHouse',query:{
        houseId:this.houseInfo.houseId
      }})
    }
  },
  mounted() {
    //do something after mounting vue instance
    // console.log(this.$route.params.houseId);
    this.houseId = this.$route.query.houseId;    //房源id
    this.lng = this.$route.query.lng;
    this.lat = this.$route.query.lat;
    console.log(this.houseId);
    this.getHouseDetail();
    this.getHouseConfig();
  },
  components: {
    bannerSlider,
    houseAllocation,
    aMap,
  }
}
